<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0
    ,user-scalable=no">
    <title>Document</title>
    <style>
        * {
            margin: 0px;
            padding: 0px;
        }

        body {
            width: 100%;
            min-width: 320px;
            max-width: 540px;
            font-size: 14px;
            color: white;
        }

        .header {
            height: 45px;
        }

        .header div {
            float: left;
            /* 设置背景颜色 */
            background: rgb(51, 51, 51);

            /* 水平居中 */
            text-align: center;
            /* 垂直居中  设置行高和高度一致  就可以垂直居中*/
            line-height: 45px;
            height: 45px;

        }

        /* 第一块 */
        .header div:nth-child(1) {

            width: 8%;
        }

        .header div:nth-child(1) img {
            width: 10px;
            height: 10px;

        }

        /* 第二块 */
        .header div:nth-child(2) {
            width: 10%;
        }

        .header div:nth-child(2) img {
            /* 设置基准线 */
            vertical-align: middle;
            width: 30px;
        }

        .header div:nth-child(3) {
            width: 57%;
        }

        .header div:nth-child(4) {
            width: 25%;
            background: rgb(255, 12, 0);
        }

        .search {
            width: 100%;
            position: sticky;
            height: 44px;
            background: rgb(222, 0, 0);
            overflow: hidden;
        }

        .search div:nth-child(1) {
            /* 使用定位 */
            position: absolute;
            background: url(img/caidan.png) no-repeat;
            margin: 10px 10px;
            height: 18px;
            background-size: 20px 18px;
            left: 0;
            width: 40px;
        }

        /* 中间部分 */
        .search div:nth-child(2) {
            background-color: #FFF;
            height: 30px;
            border-radius: 15px;

            margin: 7px 40px;
        }

        .search div:nth-child(2) section {
            display: inline-block;
            color: rgb(221, 221, 221);
        }

        .search div:nth-child(2) section:nth-child(1) {
            width: 20px;
            height: 20px;
            background: url(img/jdlogo2.png) no-repeat;
            background-size: 20px 20px;
            margin-left: 12px;
            margin-top: 5px;
        }

        .search div:nth-child(2) section:nth-child(1)::after {
            content: '';
            display: inline-block;
            width: 1px;
            background-color: rgb(221, 221, 221);
            position: relative;
            left: 25px;
            top: 0px;
            height: 20px;
        }

        .search div:nth-child(2) section:nth-child(2) {
            width: 20px;
            height: 20px;
            position: relative;
            background: url(img/jd-sprites.png) no-repeat;
            background-position: -80px 0px;
            background-size: 200px 200px;
            margin-left: 12px;
            top: 4px;
        }

        .search div:nth-child(2) section:nth-child(3) {
            position: relative;
            top: -5px;
        }

        .search div:nth-child(3) {
            position: absolute;
            right: 0px;
            top: 0px;
            width: 40px;
            line-height: 44px;
            text-align: center;
        }
    </style>
</head>

<body>
    <!-- 头部 -->
    <div class="header">
        <div>
            <img src="img/cha.png" alt="">
        </div>
        <div>
            <img src="img/jdlogo.png" alt="">
        </div>
        <div>打开京东App, 购物更轻松</div>
        <div>立即打开</div>

    </div>

    <!-- 搜索栏 -->
    <div class="search">
        <div></div>
        <div>
            <section></section>
            <section></section>
            <section>格兰仕</section>
        </div>
        <div>登录</div>
    </div>
</body>

</html>